using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HermesPortal.Core;  
/// <summary>
/// Summary description for PortalSecurity
/// </summary>
namespace HermesPortalUI
{
    public class PortalSecurity
    {
        public PortalSecurity()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public static bool IsInRole(int creatorId,int sagaID,SagaRoles role )
        {
            Creator cr = UserServices.GetCreator(creatorId);   
            if (role == SagaRoles.sysAdmin )
            {
              return   Roles.IsUserInRole(cr.UserName, "sysAdmin");  
            }
            SagaRoles sagaRole = UserServices.GetCreatorRoleForSaga(creatorId, sagaID);
            return (role == sagaRole);
        }
    }
}
